package com.hs.feign.client;

import com.hs.common.api.dto.ResultCode;
import com.hs.common.api.dto.ResultVo;
import com.hs.feign.dto.OrderDto;
import com.hs.feign.dto.Orders;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author Bai Dingkun
 * @date 2022-07-20
 * @desc
 */
@FeignClient("order-service")
public interface OrderClient {

    /**
     * 查找指定用户下的未支付订单
     * @param tel
     * @return
     */
    @GetMapping("/orders/unpay/{tel}")
    ResultVo findUnPayOrders(@PathVariable("tel") String tel);

    /**
     * 生产者发送信息（车辆为驶离）
     */
    @PostMapping("/orders/send")
    void sendOrder(@RequestBody OrderDto orderDto);

    /**
     * 结束订单
     * @param orderId
     * @return
     */
    @GetMapping("/orders/end/{orderId}")
    ResultVo finishOrder(@PathVariable("orderId") Long orderId);

    /**
     * 条件查询(订单详情)
     * @param orderId
     * @param carLicensePlate
     * @param berthId
     * @return
     */
    @GetMapping("/orders/condition")
    ResultVo findOrderByConditions(@RequestParam("orderId") Long orderId, @RequestParam("carLicensePlate") String carLicensePlate, @RequestParam("berthId") Integer berthId, @RequestParam("status") Integer status);

    /**
     * 保存订单
     */
    @PostMapping("/orders/save")
    @ApiOperation("生成订单")
    ResultVo saveOrder(@RequestBody Orders orders);

}
